import request from '@/utils/request'

// 获取
export function getListAPI(params) {
  return request({
    url: '/data',
    method: 'GET',
    params
  })
}

// 新增
export function addDataAPI(data) {
  return request({
    url: '/data',
    method: 'POST',
    data
  })
}

// 数据回显
export function getDetailAPI(id) {
  return request({
    url: `/data/${id}`,
    method: 'GET'
  })
}

// 编辑数据
export function editDataAPI(data) {
  return request({
    url: `/data/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除数据
export function delDataAPI(id) {
  return request({
    url: `data/${id}`,
    method: 'DELETE'
  })
}

// 搜索
export function searchListAPI(name) {
  return request({
    url: `/data/?name=${name}`,
    method: 'GET'
  })
}
